package com.qfedu.yanglao20admin.comment.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qfedu.yanglao20admin.comment.dao.ReviewConfigurationDao;
import com.qfedu.yanglao20admin.comment.entity.ReviewConfiguration;
import com.qfedu.yanglao20admin.comment.param.ReviewConfigurationParam;
import com.qfedu.yanglao20admin.comment.service.ReviewConfigurationService;
import com.qfedu.yanglao20admin.health.entity.HealthData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("reviewConfigurationServic")
public class ReviewConfigurationServiceImpl implements ReviewConfigurationService {
    @Resource
    private ReviewConfigurationDao reviewConfigurationDao;
    /**
     * 分页查询评述配置
     *
     * @param param
     * @return
     */
    @Override
    public Page<ReviewConfiguration> pageReview(ReviewConfigurationParam param) {
        // 分页查询
        Page<ReviewConfiguration> page = new Page<>(param.getPageNum(), param.getPageSize());
       List<ReviewConfiguration>  reviewConfigurations=reviewConfigurationDao.selectList(param);

        // 页码
        page.setCurrent(param.getPageNum());
        page.setSize(param.getPageSize());

        page.setRecords(reviewConfigurations);

        return page;
    }

    /**
     * 更具id删除评述配置
     *
     * @param id
     */
    @Override
    public void deletebyid(Integer id) {
        reviewConfigurationDao.deleteByid(id);
    }

    /**
     * 添加评述配置
     *
     * @param reviewConfiguration
     */
    @Override
    public void insertrever(ReviewConfiguration reviewConfiguration) {
        reviewConfigurationDao.insertReview(reviewConfiguration);
    }

    /**
     * 更具id获取数据
     *
     * @param
     * @return
     */
    @Override
    public ReviewConfiguration queryByid(Integer id) {
        return reviewConfigurationDao.queryid(id);
    }

    /**
     * 更新配置信息
     *
     * @param reviewConfiguration
     */
    @Override
    public void update(ReviewConfiguration reviewConfiguration) {
        reviewConfigurationDao.updatereview(reviewConfiguration);
    }
}
